package com.sky.apollo.executor.web;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class TestController {

    @Value("${name}")
    private String name;

    @Resource
    private RedisTemplate<String, String> redisTemplate;

    @RequestMapping("/test")
    @ResponseBody
    public String test(){
        return name;
    }


    @RequestMapping("/set")
    @ResponseBody
    public String set(){
        redisTemplate.opsForValue().set("test", "1");
        return "success";
    }

    @RequestMapping("/get")
    @ResponseBody
    public String get(){
        return  redisTemplate.opsForValue().get("test");
    }
}
